cmake_minimum_required(VERSION 3.10)

set(PROJECT_N ssh-server )
project(${PROJECT_N} VERSION 1.0)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/src/*.cpp)

# a macro that gets all of the header containing directories. 
MACRO(header_directories return_list includes_base_folder extention )
    FILE(GLOB_RECURSE new_list ${includes_base_folder}/*.${extention})
    SET(dir_list "")
    FOREACH(file_path ${new_list})
        GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
        SET(dir_list ${dir_list} ${dir_path})
    ENDFOREACH()
    LIST(REMOVE_DUPLICATES dir_list)
    SET(${return_list} ${dir_list})
ENDMACRO()
header_directories(INCLUDES ${PROJECT_SOURCE_DIR}/include/ hpp)
message("src files:")
foreach(file ${SRCS})
        message(STATUS ${file})
endforeach()
message("include directories:")
foreach(dir ${INCLUDES})
        message(STATUS ${dir})
endforeach()

add_executable(${PROJECT_N} ${SRCS})
target_include_directories(${PROJECT_N} PUBLIC include)
# 依赖 libssh库
add_subdirectory(require/libssh-mirror)
target_link_libraries(${PROJECT_N}  ssh::ssh)
add_compile_options(-fno-omit-frame-pointer -fsanitize=address)

